import React, { Component } from 'react'
import { BrowserRouter, Switch, Route, Redirect } from 'react-router-dom'
import asyncComponent from '@/utils/asyncComponent'

const home = asyncComponent(() => import("@/views/home"))
const power = asyncComponent(() => import("@/views/power"))
const powerDetail = asyncComponent(() => import("@/views/powerDetail"))
const feeDetail = asyncComponent(() => import("@/views/feeDetail"))
const miner = asyncComponent(() => import("@/views/miner"))
const minerDetail = asyncComponent(() => import("@/views/minerDetail"))
const notice = asyncComponent(() => import("@/views/notice"))
const noticeDetail = asyncComponent(() => import("@/views/noticeDetail"))
const dashboard = asyncComponent(() => import("@/views/dashboard"))
const myOrder = asyncComponent(() => import("@/views/myOrder"))
const powerOrder = asyncComponent(() => import("@/views/powerOrder"))
const feeOrder = asyncComponent(() => import("@/views/feeOrder"))
const wallet = asyncComponent(() => import("@/views/wallet"))
const safe = asyncComponent(() => import("@/views/safe"))
const invite = asyncComponent(() => import("@/views/invite"))
const withdraw = asyncComponent(() => import("@/views/withdraw"))
const walletRecord = asyncComponent(() => import("@/views/walletRecord"))
const orderDetail = asyncComponent(() => import("@/views/orderDetail"))


export default class RouteConfig extends Component {
  render() {
    return (
      <BrowserRouter>
        <Switch>
          <Route path="/home" exact component={home} />
          <Route path="/power" exact component={power} />
          <Route path="/powerDetail/:id" exact component={powerDetail} />
          <Route path="/feeDetail/:id" exact component={feeDetail} />
          <Route path="/miner" exact component={miner} />
          <Route path="/minerDetail/:id" exact component={minerDetail} />
          <Route path="/notice" exact component={notice} />
          <Route path="/noticeDetail/:id" exact component={noticeDetail} />
          <Route path="/dashboard" exact component={dashboard} />
          <Route path="/myOrder" exact component={myOrder} />
          <Route path="/powerOrder" exact component={powerOrder} />
          <Route path="/feeOrder" exact component={feeOrder} />
          <Route path="/wallet" exact component={wallet} />
          <Route path="/safe" exact component={safe} />
          <Route path="/invite" exact component={invite} />
          <Route path="/withdraw/:name" exact component={withdraw} />
          <Route path="/walletRecord/:type/:name" exact component={walletRecord} />
          <Route path="/orderDetail/:id" exact component={orderDetail} />
          <Redirect from='/' to='/home' />
        </Switch>
      </BrowserRouter>
    )
  }
}